package com.cloud.controller;

import com.cloud.domain.TOrder;
import com.cloud.service.IOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RequestMapping("/consumer")
@RestController
public class TestController {
    @Autowired
    private IOrderService iOrderService;

    @RequestMapping("/getOrder")
    public TOrder getOrder(Long id) {
        if (id == null) {
            return null;
        }
        if (id < 0) {
            int i = 10 / 0;
        }
        TOrder responseResult = iOrderService.getById(id);
        System.out.println(responseResult);
        return responseResult;
    }

    @RequestMapping("/listAll")
    public List<TOrder> listAll() {
        List<TOrder> list = iOrderService.listAll();
        System.out.println(list);
        return list;
    }

}